﻿
namespace Mes.Application.DTO.Inputs.Operations
{
    public class OperInput
    {
        public string Process_Id { get; set; } = string.Empty;

        public int Process_Route_Id { get; set; } = 0;
    }

    public class OperEntLinkInput
    {
        public int Ent_Id { get; set; } = -1;

        public double Est_Prod_Rate { get; set; } = 0.0;

        public double? Est_Lab_Rate { get; set; } = null;

        public double? Est_Setup_Time { get; set; } = null;

        public double? Est_Teardown_Time { get; set; } = null;

        public double? Est_Transfer_Time { get; set; } = null;
    }

    public class OperAttrInput
    {
        public int Attr_Id { get; set; } = -1;

        public string? Attr_Value { get; set; } = null;

        public string? Notes { get; set; } = null;

        public string? Last_Edit_Comment { get; set; } = null;
    }

    public class OperStepGrpCommon
    {
        public int Step_Grp_Id { get; set; } = 0;

        public string Step_Grp_Desc { get; set; } = string.Empty;

        public int Step_Grp_Seq { get; set; } = 0;

        public string? Last_Edit_Comment { get; set; } = null;
    }

    public class OperStepGrpInput : OperStepGrpCommon
    {
        public List<OperStepInput> OperSteps { get; set; }
    }

    public class OperStepCommon
    {
        public int Step_No { get; set; } = 0;

        public int Step_Seq { get; set; } = 0;

        public string? Step_Name { get; set; } = null;

        public string Step_Desc { get; set; } = string.Empty;

        public string? Last_Edit_Comment { get; set; } = null;
    }

    public class OperStepInput : OperStepCommon
    {
        public BomItemOperLinkInput? BomItemsOperStep { get; set; } = null;
    }

    public class BomItem
    {
        public int Bom_Pos { get; set; } = 0; // Material_Id

        public string MaterialCode { get; set; }

        public double Qty_Per_Parent_Item { get; set; } = 0;
    }

    public class BomItemOperLinkInput
    {
        public int Bom_Id { get; set; } = 0; // Bom_Id

        public List<BomItem> BomItems { get; set; }
    }

    public class OperCommon
    {
        public string Process_Id { get; set; } = string.Empty;

        public string Oper_Id { get; set; } = string.Empty;

        public string? Oper_Desc { get; set; } = null;

        public string? Oper_Type { get; set; } = null;

        public double? Oper_Cost { get; set; } = null;

        public string? Notes { get; set; } = null;
    }

    public class OperUpdateInput : OperCommon
    {
        public List<OperEntLinkInput> OperEntLinks { get; set; }

        public List<OperAttrInput>? OperAttrs { get; set; }

        public List<OperStepGrpInput>? OperStepGrps { get; set; }

        public BomItemOperLinkInput? BomItemsOper { get; set; }
    }
}
